import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop014_商品管理删除分类"
#并且打开dbshop的后台
firefox=openBrowser(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
# 1.点击分类名称为“商品分类测试”后方的删除分类"链接
DBshopEnterMenu3(firefox,'商品管理','管理分类','商品分类')
time.sleep(40)
firefox.find_element_by_xpath('//td[contains(.,"%s")]/following-sibling::td[4]/a[3]'%goodsClassName).click()
firefox.switch_to.alert.accept()
# 断言
try:
    firefox.find_element_by_xpath('//td[text()="%s"]'%goodsClassName)
    writeLog("%s 测试失败"%testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)

firefox.quit()